WOFF is a font format popularized by its use in web pages on the WWW. WOFF is essentially a TrueType or OpenType font with additional compression and metadata.
To use a WOFF font in a PDF, first create a WebOpenFont instance with the font's file path passed to the constructor. Then reuse the font as needed throughout the PDF.
NOTE: web fonts created using DynamicPDF are converted to the equivalent TrueType font when generating the resultant PDF document.
The following illustrates using a WOFF font to create a PDF document.
[Java]
// Create a web open font
WebOpenFont webOpenfont = new WebOpenFont(webOpenFontPath);
//Create a label
Label label = new Label("This text uses web opent font ", 0, 0, 300, 300);
// Assign web open font to label
label.setFont(webOpenfont);
By default, when generating a PDF using WebOpenFont, only the characters used are embedded in the resulting PDF document. Embedding only the characters used dramatically reduces the resulting file size. You can override this behavior and embed all the characters by setting the Embed property of the WebOpenFont to true. When set to true, the font embeds all characters - used and unused - in a generated PDF.
When using the same WOFF font multiple times within the same document, be sure to create a WebOpenFont instance once only. Then use the font as needed throughout the PDF. This reuse significantly reduces the resulting file size by preventing the PDF from embedding the font multiple times in the same document.